#ifndef THREAD_H
#define THREAD_H
#include <pthread.h>
#include "sock_event.h"
#include "queue.h"

typedef struct {
	pthread_t id;        /* unique ID of this thread */
	event_base_t *base;    /* libevent handle this thread uses */
	event_t notify_event;  /* listen event for notify pipe */
	int notify_receive_fd;      /* receiving end of notify pipe */
	int notify_send_fd;         /* sending end of notify pipe */
	queue_t *waiting_conns;
	queue_t *active_conns;
}thread_t;

extern void thread_init(int number);
extern void thread_clean(void);
extern thread_t *thread_select(void);
#endif
